package service

import (
	"SE/model"
	"SE/repository"
)

type PService struct {
	pRepo *repository.PRepository
}

func NewPService(pRepo *repository.PRepository) *PService {
	return &PService{pRepo: pRepo}
}

func (ps *PService) GetP(id string) ([]model.CarP, error) {
	return ps.pRepo.GetP(id)
}

func (ps *PService) GetAllP() ([]model.P, error) {
	return ps.pRepo.GetAllP()
}

func (ps *PService) AddP(newP model.P) error {
	return ps.pRepo.AddP(newP)
}

func (ps *PService) UpdateP(newP model.P) error {
	return ps.pRepo.UpdateP(newP)
}

func (ps *PService) GetMyp(mid int) ([]model.P, error) {
	return ps.pRepo.GetMyp(mid)
}
